From 3a9274f3204bf5e3c61f8ca0f6230301bfc07038 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 13 Jul 2005 08:37:38 +0000 Subject: [PATCH] The patch attached restores NX/XD support in x86_64 xenlinux. When the port was being done, Xen did not want to see the bit 63 in ptes, and it now allows the guests to set it. Also include cleanups (warning when compiling domU). Signed-off-by: Jun Nakajima --- .../arch/xen/x86_64/kernel/setup64.c | 10 ++-------- .../arch/xen/x86_64/mm/init.c | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c index 07e0035617..e5fd75f06b 100644 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c @@ -194,16 +194,10 @@ void __init check_efer(void) { unsigned long efer; - /* rdmsrl(MSR_EFER, efer); */ - - /* - * At this point, Xen does not like the bit 63. - * So NX is not supported. Come back later. - */ - efer = 0; - + rdmsrl(MSR_EFER, efer); if (!(efer & EFER_NX) || do_not_nx) { __supported_pte_mask &= ~_PAGE_NX; + } } diff --git a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c index 0bb164a88c..b99641750b 100644 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c @@ -641,8 +641,6 @@ void zap_low_mappings(void) #ifndef CONFIG_DISCONTIGMEM void __init paging_init(void) { - int i; - { unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; /* unsigned int max_dma; */ @@ -664,14 +662,17 @@ void __init paging_init(void) memset(empty_zero_page, 0, sizeof(empty_zero_page)); #ifdef CONFIG_XEN_PHYSDEV_ACCESS + { + int i; /* Setup mapping of lower 1st MB */ - for (i = 0; i < NR_FIX_ISAMAPS; i++) - if (xen_start_info.flags & SIF_PRIVILEGED) - set_fixmap(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE); - else - __set_fixmap(FIX_ISAMAP_BEGIN - i, - virt_to_machine(empty_zero_page), - PAGE_KERNEL_RO); + for (i = 0; i < NR_FIX_ISAMAPS; i++) + if (xen_start_info.flags & SIF_PRIVILEGED) + set_fixmap(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE); + else + __set_fixmap(FIX_ISAMAP_BEGIN - i, + virt_to_machine(empty_zero_page), + PAGE_KERNEL_RO); + } #endif } -- 2.30.2